home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 25 / q25.d81 / t.megabasic 2 < prev    next >
Text File  |  2022-08-28  |  11KB  |  284 lines

  1.  
  2.                              M E G a B a s i c
  3.  
  4.                                by e. g. bell
  5.                                       
  6.     The following is a continuation of the documentation for MEGaBasic began
  7. in "t.megabasic 1".
  8.  
  9.  
  10. *** Quit
  11.  
  12.     QUIT disables MEGaBasic.
  13.  
  14. *** Read
  15.  
  16.     READ allows you to view a sequential type file from disk without
  17. disturbing the program you have in memory.  The format for the READ command
  18. is:
  19.  
  20.  read "filename" <,u#>
  21.  
  22.  Ex:
  23.  read "Top Secret",u9
  24.  or  read "Top Secret"
  25.  
  26. *** Resave
  27.  
  28.     If you have been using Commodore computers and disk drives for a long
  29. enough period of time, you no doubt remember the great save with replace
  30. controversy.  It was finally proven to be caused by a bug in the 1541 and
  31. 1571 drive ROMs, carried over from their dual-drive ancestors.  Supposedly
  32. the 1571 was fixed and the 1581 never suffered the bug.  However, some of us
  33. who got bitten by the bug stopped trusting the SAVE "@0:" form of the save
  34. command.  It was just as effective, and much safer, to delete the file first
  35. then save it.  That is what RESAVE does.  It deletes the file first, then
  36. does a normal save.  The format of the command is:
  37.  
  38.  resave "filename" <,u#>
  39.  
  40.  Ex:
  41.  resave "version02",u9
  42.  or  resave "version02"
  43.  
  44. *** Old
  45.  
  46.     This is a simple way to restore a program that you have accidentally
  47. 'NEW'ed.  This is a common utility, sometimes called UNNEW.
  48.  
  49. *** Move
  50.  
  51.     You are going to love this one!  MOVE allows you to move blocks of lines
  52. from one location to another in your BASIC program files.  It is very handy
  53. when structuring your programs for efficient order and operation.  For
  54. example, due to the way GOSUB operates, it is faster to have your
  55. subroutines located at the start of your BASIC program in most cases.  The
  56. format of the MOVE command is:
  57.  
  58.  move, from-line, to-line, target-line
  59.  
  60. The from-line is the first line of the block to be moved.  The to-line is
  61. the last line of that block.  The target-line is the line after which you
  62. want to move the block.  
  63.  
  64.  Ex:
  65.  move,100,500,20
  66.  
  67.  moves lines 100 through 500 inclusive to follow line 20.
  68.  
  69.  or  move,100,500,1000
  70.  
  71.  moves lines 100 through 500 inclusive to follow line 1000.
  72.  
  73. All three parameters are required.  NOTE!  The comma immediately after the
  74. MOVE command is necessary.  You cannot MOVE a block of lines to a target
  75. line within itself, and finally, the from-line must be less than or equal to
  76. the to-line.
  77.  
  78.     MOVE does not change line numbers.  It just dutifully moves the
  79. specified block from here to there.  When it is done, you will get a message
  80. that 'You MUST RENUMBER or RESequence NOW!'.  Don't ignore this.  Do it
  81. immediately.  It will cause problems if you don't do it.
  82.  
  83.     You might be wondering right now what this MOVE does to the gosub and
  84. goto references in your program.  The answer is that if you follow all
  85. directions -- namely renumbering the program after the MOVE -- there is no
  86. effect at all.  All line references will be correctly renumbered, including
  87. any within or to the block of lines that were moved.
  88.  
  89. *** Combine
  90.  
  91.     Merge is a very handy utility, but in larger programs it tends to be
  92. slow because each new line has to be spliced in, and room has to be made for
  93. each line.  COMBINE is a much quicker alternative.  COMBINE could also have
  94. been called APPEND, which is what it does.  It simply APPENDs the desired
  95. file from disk to the end of the program in memory.  The syntax is:
  96.  
  97.  combine "filename" <,u#>
  98.  
  99.  Ex:
  100.  combine "newlines",u9
  101.  or   combine "newlines"
  102.  
  103. Line numbers are not changed in either program.  The reason this command was
  104. added was primarily for editing of BASIC format machine language source
  105. files, where line references are not used for program execution.  If you use
  106. an assembler like EGads or PAL that use BASIC format source files, you will
  107. find this utility most useful.
  108.  
  109.     If you use COMBINE with BASIC programs, either make sure the program you
  110. are combining has a unique set of line numbers, or that there are no
  111. references (i.e. GOTO, GOSUB, THEN, etc.) to lines with the same numbers in
  112. both programs.  The first occurrence of a line number in a program is the
  113. one to which *ALL* such references will be directed when you RENUMBER your
  114. program.  This could be disastrous.
  115.  
  116.     COMBINE is a great utility for starting a new program using a library of
  117. routines as a foundation.
  118.  
  119. *** Lsave
  120.  
  121.     This command is probably my favorite of all the ones available.  I have
  122. never seen it on a Commodore utility, though it is so useful I don't know
  123. how I ever got along without it.  What it allows you to do is save a range
  124. of lines of the current program in memory to disk in a named file.  Just
  125. wait to see how easy it is to start building your library of best-loved
  126. routines using LSAVE.  The format of the LSAVE command is:
  127.  
  128.  lsave "filename" <,u#><,from-line><,to-line>
  129.  
  130.     If you want the save to go to the currently specified device, you don't
  131. have to use the ,u# parameter, but you must still account for it.  Just use
  132. the comma with no entry, then a second comma followed by the from-line
  133. entry.
  134.  
  135.  Ex:
  136.  lsave "directory.rtn",,100,300
  137.  
  138.  saves a file consisting of lines 100 through 300 inclusive of the program
  139. in memory to a file called 'directory.rtn' on the current drive.
  140.  
  141.  lsave "directory.rtn",u8,100
  142.  
  143.  saves a file consisting of lines 100 through the end of the program in
  144. memory to a file called 'directory.rtn' on drive 8.
  145.  
  146. *** Start
  147.  
  148.     This function allows you to display the load address of the specified
  149. file on disk.  The syntax is:
  150.  
  151.  start "filename" <,u#>
  152.  
  153. MEGaBasic returns the load address of 'filename'.
  154.  
  155. *** Compare
  156.  
  157.     This utility is kind of interesting.  On occasion I work with other
  158. programmers on machine language projects.  This is rather hard to
  159. coordinate.  You have two people changing a program source file or files at
  160. the same time.  Who ever knows what the other guy did?  You have to know
  161. that in order to make sure all the changes are in the final copy.  COMPARE
  162. started life as a BASIC/ML utility that did this job.  It has been
  163. assimilated into MEGaBasic, but performs the same job.  Note that COMPARE
  164. only works with BASIC format files.
  165.  
  166.     The format of the COMPARE command is:
  167.  
  168.  compare "file1" <,u#> ["file2" or "*"] <,u#> [<,p#> or <,"log"><,u#>]
  169.  
  170. First, let me try to explain what COMPARE does.  COMPARE works by pulling
  171. both copies, 'file1' and 'file2', into memory, then comparing them line by
  172. line.  Differences are reported to your specified medium, which I'll discuss
  173. shortly.  COMPARE does two passes, comparing file 1 to file 2, then file 2
  174. to file 1.  This is because lines could have been added and/or deleted, and
  175. this is the only way to make sure they are all accounted for.  Some
  176. duplication in the report is possible due to the two passes.
  177.  
  178.     It is important to note that COMPARE will only give you a usable report
  179. if you have not renumbered either of the files.  If you renumber the files,
  180. there is little chance of getting a valid comparison because most if not all
  181. of the lines are going to be reported as different.  I recommend renumbering
  182. your programs by 20 or 30 before editing.  That gives you plenty of room
  183. between lines for edits without having to renumber.
  184.  
  185.     Now, let's break the command format down into smaller pieces to better
  186. understand that dizzying collection of characters.
  187.  
  188.  compare "file1" <,u#> ["file2" <,u#> or "*"] [<,p#> or <,"log"><,u#>]
  189.          -------------
  190.  
  191. "file1" is the first file parameter to compare.   Think of this as the file
  192. you want to compare something to.  This file ends up in RAM 1 after the
  193. comparison operation.  It is not the file you will be working with, nor will
  194. it be available in RAM 0 memory for editing after the compare.  It is the
  195. 'constant' in the comparison.
  196.  
  197.     Note the <,u#> argument.  This is the same drive specifier discussed
  198. earlier in this document.  It is not necessary to include it, and you don't
  199. need the comma if you don't specify the drive.
  200.  
  201.  compare "file1" <,u#> ["file2" <,u#> or "*"] [<,p#> or <,"log"><,u#>]
  202.                        --------------------
  203.  
  204. The second parameter has two possible forms, one of which MUST be used.  If
  205. you want to compare a file on disk to "file1